<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Attribute extends Model
{
    protected $guarded=[];
    //获得属性 的子属性
    public function attributeSon(){
        return $this->hasMany(Attribute::class,'pid','id');
    }
    //通过子属性找父属性
    public function  attributeFather(){
        return $this->belongsTo(Attribute::class,'id','pid');
    }
}
